//
//  SSSMyIncomeViewController.m
//  SSSMerchant
//
//  Created by xnxin on 2017/3/20.
//  Copyright (c) 2017 xnxin. All rights reserved.
//

#import "SSSMyIncomeViewController.h"
#import "SSSMyIncomeViewCellModel.h"
#import "XHTableViewSection.h"
#import "Merchant/SSSMerchantBenefitPagerController.h"
#import "Personal/SSSPersonalIncomePagerViewController.h"

@interface SSSMyIncomeViewController ()

@end

@implementation SSSMyIncomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];



    self.edgesForExtendedLayout = UIRectEdgeAll;

    self.title = @"我的收益";
    self.tableView.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);
    self.tableView.rowHeight = 150;

    SSSMyIncomeViewCellModel *model1 = [SSSMyIncomeViewCellModel new];
    model1.imgName = @"icon_store";
    model1.deteailImgName = @"icon_word_store";

    SSSMyIncomeViewCellModel *model2 = [SSSMyIncomeViewCellModel new];
    model2.imgName = @"icon_personage";
    model2.deteailImgName = @"icon_word_personage";

    [self.dataSource resetWithSections:[XHTableViewSection sectionsWithArray:@[model1, model2]]];
}

- (NSArray<NSString *> *)classNameArray {
    return @[@"SSSMyIncomeViewCell"];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.001;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 15;
}

- (UITableViewStyle)tableViewStyle {
    return UITableViewStyleGrouped;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSInteger section = indexPath.section;

    switch (section) {
        case 0: {
            UIViewController *vc = [SSSMerchantBenefitPagerController new];
            vc.hidesBottomBarWhenPushed = true;
            [self.navigationController pushViewController:vc animated:true];
        }
            break;
        case 1:{

            UIViewController *vc = [SSSPersonalIncomePagerViewController new];
            vc.hidesBottomBarWhenPushed = true;
            [self.navigationController pushViewController:vc animated:true];
        }
            break;
        default:
            break;
    }

    [tableView deselectRowAtIndexPath:indexPath animated:true];
}
@end
